package io.easyspring.demo.basis.rbac.service;

import io.easyspring.demo.basis.rbac.model.User;
import io.easyspring.framework.base.service.BaseService;
import com.github.pagehelper.Page;
import io.easyspring.framework.base.service.ExtensionBaseService;
import org.springframework.data.domain.Pageable;
import org.springframework.validation.annotation.Validated;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * 用户对象 服务类
 *
 * @author summer
 * @version 2.0.0-RELEASE
 * DateTime 2019-10-15 15:15:03
 */
@Validated
public interface UserService extends ExtensionBaseService<User> {

    /**
     * 添加用户的方法
     *
     * @param user 用户对象
     * @return io.easyspring.demo.basis.rbac.model.User
     * Author summer
     * Version 2.0.0-RELEASE
     * DateTime 2019-10-15 15:29
     */
    User buildSave(@NotNull(message = "用户对象不能为空")
                   @Valid User user);

    /**
     * 修改用户的方法
     *
     * @param user 用户对象
     * @return io.easyspring.demo.basis.rbac.model.User
     * Author summer
     * Version 2.0.0-RELEASE
     * DateTime 2019-10-15 15:34
     */
    User buildUpdate(@NotNull(message = "用户对象不能为空")
                     @Valid User user);

    /**
     * 根据传入的关键字和分页信息, 查询用户对象的分页数据
     *
     * @param keyWord 关键字
     * @param pageable 分页信息
     * @return com.github.pagehelper.Page<User>
     * Author summer
     * Version 2.0.0-RELEASE
     * DateTime 2019-10-15 15:15:03
     */
    Page<User> findPageBuilder(String keyWord, Pageable pageable);
}
